package com.deepclassifieds.daas.common;

import java.util.LinkedHashMap;
import java.util.Map;

public class DualMap<K,V> {

	private final Map<K,V> toValue = new LinkedHashMap<K,V>();
	private final Map<V,K> toKey   = new LinkedHashMap<V,K>();

	public void put(K key, V value) {
		Reject.ifNull(key);
		Reject.ifNull(value);
		toValue.put(key, value);
		toKey.put(value, key);
	}
	
	public V getValue(K key) {
		return toValue.get(key);
	}

	public K getKey(V value) {
		return toKey.get(value);
	}
}
